#version 460
#define GLSLIFY 1

#define GLSLIFY 1
#define COLOR_BUILD

vec4 f_buildColor(in uint color){
	vec4 TColor;
	TColor.r = float((color & 0xff000000) >> 24) / 255.0;
	TColor.g = float((color & 0x00ff0000) >> 16) / 255.0;
	TColor.b = float((color & 0x0000ff00) >> 8) / 255.0;
	TColor.a = float((color & 0x000000ff)) / 255.0;

	return TColor;
}

layout(location = 0) in vec3 vColor;
layout(location = 1) in vec3 vNormal;
layout(location = 2) in vec3 vLightPos[4];

layout(location=0) out vec4 outColor;

layout(std140, set=0, binding=3) uniform U_Matrix {
	uint m_Color;
};

void main(void){
	float d = (dot(vLightPos[0], vNormal)) + 1.0;
	//float d = dot(vLightPos[0], vNormal);

	vec4 Color = f_buildColor(m_Color);

	outColor = vec4(Color.rgb * d * 0.5, Color.a);
	//outColor = vec4(Color.rgb * d, Color.a);
	//outColor.rgb += vec3(0.2, 0.21, 0.22) * d;
	
	//outColor = vec4(vColor, 1);
	//outColor = vec4(1.0, 0.0, 1.0, 1.0);
}

